package com.banyuan.domain;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;

public class Person {
    private String name;
    private Integer age;
    private List<String> address;//能用接口就用接口 ，如，List是接口，不用实现类ArrayList
    private String[] hobby;
    private Dog dog;
    private Date date;


    public Person() {
    }

    public Person(String name, Integer age, List<String> address, String[] hobby, Dog dog, Date date) {
        this.name = name;
        this.age = age;
        this.address = address;
        this.hobby = hobby;
        this.dog = dog;
        this.date = date;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public List<String> getAddress() {
        return address;
    }

    public void setAddress(List<String> address) {
        this.address = address;
    }

    public String[] getHobby() {
        return hobby;
    }

    public void setHobby(String[] hobby) {
        this.hobby = hobby;
    }

    public Dog getDog() {
        return dog;
    }

    public void setDog(Dog dog) {
        this.dog = dog;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", address=" + address +
                ", hobby=" + Arrays.toString(hobby) +
                ", dog=" + dog +
                ", date=" + date +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Person person = (Person) o;
        return Objects.equals(name, person.name) && Objects.equals(age, person.age) && Objects.equals(address, person.address) && Arrays.equals(hobby, person.hobby) && Objects.equals(dog, person.dog) && Objects.equals(date, person.date);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(name, age, address, dog, date);
        result = 31 * result + Arrays.hashCode(hobby);
        return result;
    }
}
